﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 状态行为初始化
/// </summary>
[RequireComponent(typeof(Animator))]
public class AnimationBehaviorInit : MonoBehaviour {

	// Use this for initialization
	void Start () {
        foreach (var i in GetComponent<Animator>().GetBehaviours<IAnimationInit>())
        {
            i.OnStart(this);
        }
	}
    private void Awake()
    {
        foreach (var i in GetComponent<Animator>().GetBehaviours<IAnimationInit>())
        {
            i.OnAwake(this);
        }
    }
}

public abstract class IAnimationInit : StateMachineBehaviour
{
    public virtual void OnAwake(AnimationBehaviorInit anb) { }
    public virtual void OnStart(AnimationBehaviorInit anb) { }
}
